<template>
	<view class="teamQuery" @click.stop="isTeamQuery=0" v-if="isTeamQuery">

		<view class="com">
			<view v-for="(item,idx) in teamQueryList" :key="idx" @click="cacheValueFn(item)">
				<view>
					<image class="img22" :src="imgUrl+'22.png'" mode="widthFix"></image>
					{{item.projectInfoName}}
				</view>
				<view>
					<image v-if="item.cacheValue" class="img23" :src="imgUrl+'23.png'" mode="widthFix"></image>
				</view>
			</view>
		</view>

	</view>
</template>

<script>
	export default {
		components: {},
		data() {
			return {
				teamQueryList: [],
				imgUrl:this.imgUrl,
				isTeamQuery: 0
			};
		},
		onLoad(e) {

		},
		mounted() {
			if (uni.getStorageSync('token')) {
				this.getProjectInfo()
			}
		},
		methods: {

			// 下拉数据
			getProjectInfo() {
				var self = this;
				this.$http
					.getProjectInfo({
						

					})
					.then(res => {
						if (res.code == 0) {
							if (res.data && res.data.length) {
								var obj = {}
								res.data.forEach(function(e, idx) {
									if (e.cacheValue) {
										obj = e
									}
								})
								if (!obj.teamId) {
									res.data[0].cacheValue = true
								}

								self.$emit('teamQueryFn', obj.teamId ? obj : res.data[0])
							}
							this.teamQueryList = res.data


						}

					})
			},

			// 切换
			cacheValueFn(item) {
				
				this.$http
					.cacheValue({
						laborPersonId: item.laborPersonId
					})
					.then(res => {
						if (res.code == 0) {
							this.getProjectInfo()


						}

					})
			},

		}
	};
</script>

<style scoped lang="scss">
	.teamQuery {
		background: rgba(0, 0, 0, .6);
		width: 100%;
		height: 100%;
		position: fixed;
		top: 0;
		left: 0;
		z-index: 1000;

		.com {
			background: #FFFFFF;
			border-radius: 16upx 16upx 0px 0px;
			max-height: 600upx;
			overflow-y: scroll;
			position: absolute;
			bottom: 0;
			width: 100%;
			padding-bottom: 30upx;

			>view {
				display: flex;
				justify-content: space-between;
				padding: 30upx 30upx 0;
				align-items: center;
				font-size: 32upx;
				font-weight: 400;
				color: #333333;

				>view {
					display: flex;
					align-items: center;
				}

				.img22 {
					width: 64upx;
					height: 64upx;
					margin-right: 24upx;
				}

				.img23 {
					width: 40upx;
					height: 40upx;
				}
			}
		}

	}
</style>
